﻿using System;
using System.Web.UI.WebControls;
using TPG.SharePoint.Workflow; 

namespace $rootnamespace$
{
    public class $safeitemname$
        : WorkflowFormControl
    {
        protected TextBox MyWorkflowDataField;

        protected override void LoadFormData(string dataString, bool isInitialLoad)
        {
            if (isInitialLoad && String.IsNullOrEmpty(dataString) == false)
            {
                $safeitemname$.DataObject data = 
                    WorkflowDataSerializer.DeserializeFromXmlString<$safeitemname$.DataObject>(dataString);
                MyWorkflowDataField.Text = data.MyField;
            }
        }

        protected override string SaveFormData()
        {
            $safeitemname$.DataObject data = new $safeitemname$.DataObject(); 
            data.MyField = MyWorkflowDataField.Text;
            return WorkflowDataSerializer.SerializeToXmlString<$safeitemname$.DataObject>(data);            
        }   
        
        public class DataObject
        {
            public string MyField { get; set;}
        }
    }
}
